import numpy as np


class Task56_2:
    def __init__(self):
        self.BIT_MASKS = [np.int32(1 << i) for i in range(32)]

    def run(self, array):
        buffer = [0 for _ in range(32)]
        for num in array:
            num = np.int32(num)
            for index, mask in enumerate(self.BIT_MASKS):
                buffer[index] += (num & mask) >> index
        result = np.int32(0)
        for index, num in enumerate(buffer):
            if num % 3 != 0:
                result = result | self.BIT_MASKS[index]
        return result
